﻿using STHPMS1.DAL.D_Core;
using System.Data;
using ServiceStack.OrmLite;
using STHPMS1.ICore.I_Entity.Stmpms1;
using STHPMS1.Common.C_Entity.Stmpms1;
using STHPMS1.ICore.I_DAL.Repository;
using System.Collections.Generic;

namespace STHPMS1.DAL.D_Repository
{
    public class Dp_Preven_MeaintRepository : DalBase, IDp_Preven_MeaintRepository
    {

        /// <summary>
        /// 获取初选措施信息 预防性养护措施初选表 筛选适合的措施
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="str1"></param>
        /// <param name="str2"></param>
        /// <param name="str3"></param>
        /// <param name="rdclass"></param>
        /// <returns></returns>
        public List<T> Get<T>(string str1, string str2, string str3, int rdclass) where T : class, IDp_Preven_Meaint
        {
            IDbConnection conn = Adapter.OpenDbConnection();
            string strsql = "select * from DP_PREVEN_MEAINT where " + str1 + "=1 and " + str2 + "=1 and " + str3 + "=1 and  RDCLASS like '%" + rdclass + "%'";
            return conn.Select<T>(strsql);
        }


        /// <summary>
        /// 获取初选措施信息 预防性养护措施初选表 筛选适合的措施
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="str1"></param>
        /// <param name="str2"></param>
        /// <param name="str3"></param>
        /// <param name="rdclass"></param>
        /// <returns></returns>
        public List<T> Get<T>(string StrSearch, int rdclass) where T : class, IDp_Preven_Meaint
        {
            IDbConnection conn = Adapter.OpenDbConnection();
            string strsql = "select * from DP_PREVEN_MEAINT where 1=1 " + StrSearch + " and  RDCLASS like '%" + rdclass + "%'";
            return conn.Select<T>(strsql);
        }

    }
}
